package org.lql.shop.cloud.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.lql.shop.cloud.IShopService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: lql
 * @date: 2022/7/2 23:29
 * @description:
 */
@Slf4j
@RestController
@RequestMapping("/shopCart")
public class ShopCartController {

    @DubboReference(group = "jike-shop", version = "1.0.0", protocol = "dubbo", check = false, timeout = 3000)
    private IShopService iShopService;

    @GetMapping(value = "/placeOrder")
    public String placeOrder(Long cartId) {
        return iShopService.placeOrder(cartId);
    }

    @GetMapping(value = "/optimistic")
    public String optimistic(Long cartId) {
        return iShopService.optimistic(cartId);
    }
}
